-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
certutil: add functional options #240
Conversation
add functional options to New*RootCA and Generate*ChildCert to allow setting a prefix for the CN and multiple DNS names
1656938
to
cdacf83
Compare
testing/certutil/certutil.go
Outdated
func GenerateChildCert(name string, ips []net.IP, caPrivKey crypto.PrivateKey, caCert *x509.Certificate, opts ...Option) (*tls.Certificate, Pair, error) { | ||
priv, err := ecdsa.GenerateKey(elliptic.P384(), rand.Reader) | ||
if err != nil { | ||
return nil, Pair{}, fmt.Errorf("could not create RSA private key: %w", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're calling ecdsa.GenerateKey
, it looks like a typo in the error message:
return nil, Pair{}, fmt.Errorf("could not create RSA private key: %w", err) | |
return nil, Pair{}, fmt.Errorf("could not create ECDSA private key: %w", err) |
opts...) | ||
if err != nil { | ||
return nil, Pair{}, fmt.Errorf( | ||
"could not generate child TLS certificate CA: %w", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the 'CA' at the end of this error message? I believe "could not generate child TLS certificate: %w" would be enough.
"could not generate child TLS certificate CA: %w", err) | |
"could not generate child TLS certificate: %w", err) |
💚 Build Succeeded
History
cc @AndersonQ |
add functional options to New*RootCA and Generate*ChildCert to allow setting a prefix for the CN and multiple DNS names
What does this PR do?
Add functional options to NewRootCA and GenerateChildCert to allow setting a prefix for the CN and multiple DNS names.
Also, it fixes
GenerateChildCert
generating a RSA instead of EC certificateWhy is it important?
Checklist
[ ] I have added tests that prove my fix is effective or that my feature worksAuthor's Checklist